<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Welcome to CodeIgniter</title>
	<script src="<?=base_url();?>js/jquery.js"></script>
<style>
	#flash_message {
		color: red;
	}
	.error {
		color: red;
	}
</style>	
</head>
<body>
<? if ($this->session->flashdata('flash_message')): ?>	
<span id="flash_message"><p><?=$this->session->flashdata('flash_message');?></p></span>
<script>
	setTimeout(function(){document.getElementById("flash_message").style.display = 'none';}, 2000);
</script>
<? endif; ?>
<h1><?=anchor('post', 'refresh this page');?>&nbsp;&nbsp;<?=anchor('post/post_list', 'post list');?></h1>

<?=validation_errors('<div class="error">', '</div>');?>
<?=form_open('post');?>
<p>title: <?=form_input('title', set_value('title'))?></p>
<p>content:<br/><?=form_textarea('content', set_value('content'))?></p>
<p>author: <?=form_input('author', set_value('author', 'meng'))?></p>
<?=form_submit('', 'Submit Post!');?>
</form>

<hr />
<p>db record</p>
<table border="0" cellpadding="4" cellspacing="0">
 <thead>
   <tr>
	<th>id</th><th>title</th><th>author</th>
   </tr>
 </thead>
 <tbody>
  <? foreach ($post_data as $post): ?>
  <tr>
	<td><?=$post->id?></td>
	<td><a href="post/post_list/<?=$post->id?>"><?=$post->title?></a></td>
	<td><?=$post->author?></td>
	<td><a href="post/post_delete/<?=$post->id?>">delete</a></td>
  </tr>
  <? endforeach; ?>
 </tbody>
</table>

<p>Page rendered in {elapsed_time} seconds</p>

</body>
</html>